<template>
  <el-dialog :before-close="cancelPatient" :visible.sync="patientVisible" append-to-body title="患者信息" @open="onOpen">
    <el-table ref="table" v-loading="loading" :data="data" border size="small">
      <el-table-column align="center" label="患者姓名" prop="patientName"/>
<!--      <el-table-column align="center" label="身份证号" prop="idCard"/>-->
      <el-table-column align="center" label="就诊卡号" prop="visitCardNo"/>
      <el-table-column align="center" label="就诊时间" prop="jzsj"/>

      <!-- <el-table-column align="center" label="药物名称" prop="drugsName"/> -->
      <!-- <el-table-column align="center" label="药物使用周期" prop="drugsUseCycle"/> -->
      <!-- <el-table-column align="center" label="诊断结果" prop="diagnosisResult"/> -->
    </el-table>
    <pagination v-show="total>0" :limit.sync="queryForm.pageSize" :page.sync="queryForm.pageNum" :total="total"
                @pagination="searchQuery"
    />
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancelPatient">取 消</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { getPatientRemindersInfoToday } from '@/api/biobank/sample'

export default {
  data() {
    return {
      queryForm: {
        pageNum: 1,
        pageSize: 10
      },
      data: [],
      total: 0,
      loading: false
    }
  },
  props: {
    patientVisible: Boolean
  },
  methods: {
    searchQuery() {
      this.loading = true
      getPatientRemindersInfoToday(this.queryForm).then(response => {
        this.data = response.rows
        this.total = response.total
      }).finally(e => {
        this.loading = false
      })
    },
    onOpen() {
      this.resetQuery()
    },
    resetQuery() {
      this.queryForm = {
        pageNum: 1,
        pageSize: 10
      }
      this.searchQuery()
    },
    cancelPatient() {
      this.$emit('update:patientVisible', false)
    }
  }
}
</script>
